cmake_minimum_required(VERSION 3.30)
project(oop)

set(CMAKE_CXX_STANDARD 23)

add_executable(1 1.cpp)
add_executable(2 2.cpp)
add_executable(3 3.cpp)
add_executable(4 4.cpp)
add_executable(shape1 shape1.cpp)
add_executable(shape2 shape2.cpp)

include(FetchContent)
FetchContent_Declare(SFML
        GIT_REPOSITORY https://github.com/SFML/SFML.git
        GIT_TAG 3.0.1
        GIT_SHALLOW ON
        EXCLUDE_FROM_ALL
        SYSTEM)
FetchContent_MakeAvailable(SFML)

add_executable(demo triangle.cpp)
add_executable(shape1g shape1g.cpp)
add_executable(shape2g shape2g.cpp)
add_executable(draw draw.cpp)
add_executable(demo_min demo_min.cpp)
add_executable(demo_min_drag demo_min_drag.cpp)
add_executable(demo_min_timed demo_min_timed.cpp)
add_executable(demo_min_timed1 demo_min_timed1.cpp)
add_executable(demo_min_timed2 demo_min_timed2.cpp)

target_link_libraries(demo PRIVATE SFML::Graphics)
target_link_libraries(shape1g PRIVATE SFML::Graphics)
target_link_libraries(shape2g PRIVATE SFML::Graphics)
target_link_libraries(draw PRIVATE SFML::Graphics)
target_link_libraries(demo_min PRIVATE SFML::Graphics)
target_link_libraries(demo_min_drag PRIVATE SFML::Graphics)
target_link_libraries(demo_min_timed PRIVATE SFML::Graphics)
target_link_libraries(demo_min_timed1 PRIVATE SFML::Graphics)
target_link_libraries(demo_min_timed2 PRIVATE SFML::Graphics)

add_custom_target(copy_resources ALL
        COMMAND ${CMAKE_COMMAND} -E copy_directory
        "${CMAKE_SOURCE_DIR}/resources"
        "${CMAKE_BINARY_DIR}/resources"
        COMMENT "Copying resources to build root"
)

add_dependencies(draw copy_resources)

# skip terminal
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mwindows")
